package com.example.HeadFirstDemo.observe.javaImpl;

import java.util.Observable;
import java.util.Observer;

public class ObserverDemo1 implements Observer {
    private Observable observable;

    public ObserverDemo1(Observable observable) {
        this.observable=observable;
        observable.addObserver(this);
    }

    public void update(Observable o, Object arg) {
        if(arg instanceof Observable){
            System.out.println("OberseverDemo1 is updating");
        }
        System.out.println("changing");
    }
}
